<template>
  <div id="app" v-cloak>
    <router-view />
  </div>
</template>
<script>
export default {
  mounted() {
    let langs = this.getCookie("site_lang");
    if (langs == "en-US") {
      this.switchLang("en");
    } else if (langs == "zh_CN") {
      this.switchLang("zh");
    }
  },
  methods: {
    switchLang(val) {
      this.$i18n.locale = val; //此处val为 zh 或者 en
    },
    getCookie(cookieName) {
      var strCookie = document.cookie;
      var arrCookie = strCookie.split("; ");
      for (var i = 0; i < arrCookie.length; i++) {
        var arr = arrCookie[i].split("=");
        if (cookieName == arr[0]) {
          return arr[1];
        }
      }
      return "";
    }
  }
};
</script>
<style lang="scss">
#app {
  font-family: "PingFangHK-Regular";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}

[v-cloak]{
  display: none;
}

/* #nav {
      padding: 30px;
    } */

/* #nav a {
      font-weight: bold;
      color: #2c3e50;
    }

    #nav a.router-link-exact-active {
      color: #42b983;
    } */
</style>
